package o;

import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException;

public final class evh {
    private static evh ˊ = new evh();

    private evh() {
    }

    public static evh ˊ() {
        return ˊ;
    }

    public static byte[] ˎ() {
        try {
            byte[] bArr = new byte[8];
            SecureRandom.getInstance("SHA1PRNG").nextBytes(bArr);
            return bArr;
        } catch (NoSuchAlgorithmException e) {
            Logger.ˎ("SecurityEncrypt", "getSaltByte NoSuchAlgorithmException ");
            return doj.ˏ();
        }
    }

    public static byte[] ˋ() {
        return doj.ˊ();
    }

    public static byte[] ˏ() {
        try {
            return ॱ().getBytes("UTF-8");
        } catch (UnsupportedEncodingException e) {
            Logger.e("SecurityEncrypt", "getKeySeedBytes error");
            return null;
        }
    }

    private static String ॱ() {
        try {
            String ˏ = ˏ(ˏ("Ds4*%", "3Lj*8"), "#dM^%9");
            return new String(doj.ˎ(ˏ.toCharArray(), dnk.ˎ(epr.ˎ().ˊ())), "UTF-8");
        } catch (NoSuchAlgorithmException e) {
            Logger.ˎ("SecurityEncrypt", "getKeySeed NoSuchAlgorithmException ");
        } catch (InvalidKeySpecException e2) {
            Logger.ˎ("SecurityEncrypt", "getKeySeed InvalidKeySpecException ");
        } catch (UnsupportedEncodingException e3) {
            Logger.ˎ("SecurityEncrypt", "getKeySeed UnsupportedEncodingException ");
        }
        return "";
    }

    private static String ˏ(String str, String str2) throws UnsupportedEncodingException {
        byte[] bytes = str.getBytes("UTF-8");
        byte[] bytes2 = str2.getBytes("UTF-8");
        if (bytes.length < bytes2.length) {
            byte[] bArr = bytes;
            bytes = bytes2;
            bytes2 = bArr;
        }
        byte[] bArr2 = new byte[bytes.length];
        int i = 0;
        while (i < bytes2.length) {
            bArr2[i] = (byte) (bytes2[i] ^ bytes[i]);
            i++;
        }
        while (i < bytes.length) {
            bArr2[i] = bytes[i];
            i++;
        }
        return new String(bArr2, "UTF-8");
    }

    public String ˎ(String str, String str2) {
        try {
            str = eux.ॱ(str, epr.ˎ().ʻ().getBytes("UTF-8"), dnk.ˎ(str2));
        } catch (Exception e) {
            Logger.e("SecurityEncrypt", "encrypt failed.");
        }
        return str;
    }

    public String ॱ(String str, String str2) {
        try {
            str = eux.ˏ(str, epr.ˎ().ʻ().getBytes("UTF-8"), dnk.ˎ(str2));
        } catch (Exception e) {
            Logger.e("SecurityEncrypt", "decrypt failed.");
        }
        return str;
    }
}
